#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

/**
 * Definition for a binary tree node.
 */
struct TreeNode {
	int val;
	struct TreeNode* left;
	struct TreeNode* right;
};
typedef struct TreeNode treeNode, *treeNodeP;

bool isSubStructure(struct TreeNode* A, struct TreeNode* B);
bool check(struct TreeNode* A, struct TreeNode* B);

int main()
{
	return 0;
}

bool isSubStructure(struct TreeNode* A, struct TreeNode* B)
{
	return (A && B) && (check(A, B) || isSubStructure(A->left, B) || isSubStructure(A->right, B));
}

bool check(struct TreeNode* A, struct TreeNode* B)
{
	if (!B) return true;
	if (!A || A->val != B->val) return false;

	return check(A->left, B->left) && check(A->right, B->right);
}
